<script setup lang="ts">
import { provide, ref } from 'vue';
import ParentComp from './components/ParentComp.vue';

// 1. app组件数据传递给child
const count = ref(0);
provide('count', count);

// 2. app组件函数传递给child，调用的时候可以回传数据
const updateCount = (num: number) => {
  count.value += num;
};
provide('updateCount', updateCount);
</script>

<template>
  <div class="app-page" style="border: 10px solid #ccc; padding: 50px; width: 600px">
    app 组件 {{ count }} updateCount
    <ParentComp />
  </div>
</template>